/*
================================================================================
|                                                                              |
|           🔥 斗破苍穹 - 魔焰夜行 (深色主题) - REFACTORED V2 🔥              |
|              - 设计理念: 异火辉光, 灵魂深邃, 斗气涌动 -                     |
|                                                                              |
================================================================================
*/
body.theme-斗破苍穹-深色 {
    /*
    ================================================================
    |           1. Theme-specific Design Tokens                    |
    ================================================================
    */

    /* --- 1a. Theme Palette Definition --- */
    --dq-dark-heavenly-flame-red-rgb: 210, 70, 40;
    --dq-dark-nightsky-black-rgb: 12, 10, 18;
    --dq-dark-obsidian-panel-rgb: 25, 22, 32;
    --dq-dark-soul-purple-rgb: 110, 80, 160;
    --dq-dark-ancient-gold-rgb: 190, 140, 50;
    --dq-dark-demonic-cyan-flame-rgb: 50, 140, 170;
    --dq-dark-danger-crimson-rgb: 170, 30, 40;
    --dq-dark-text-ash-white-rgb: 220, 225, 230;
    /* ✅ MODIFICATION START: Increased contrast for secondary text */
    --dq-dark-text-shadow-gray-rgb: 160, 165, 175;
    /* ✅ MODIFICATION END */
    --dq-dark-volcanic-border-rgb: 45, 42, 55;

    /* --- 1b. Overriding Base Semantic Variables --- */
    --color-brand-primary: rgb(var(--dq-dark-heavenly-flame-red-rgb));
    --color-brand-primary-dark: rgb(180, 50, 20);
    --color-text-primary: rgb(var(--dq-dark-text-ash-white-rgb));
    --color-text-secondary: rgb(var(--dq-dark-text-shadow-gray-rgb));
    --color-text-on-brand: rgb(var(--dq-dark-nightsky-black-rgb));
    --color-text-link: rgb(var(--dq-dark-heavenly-flame-red-rgb));

    --color-background-page: rgb(var(--dq-dark-nightsky-black-rgb));
    --color-background-panel: rgba(var(--dq-dark-obsidian-panel-rgb), 0.9);
    --color-background-elevated: rgb(var(--dq-dark-obsidian-panel-rgb));
    --color-background-hover: rgba(var(--dq-dark-text-ash-white-rgb), 0.04);
    --color-background-active: rgba(var(--dq-dark-heavenly-flame-red-rgb), 0.18);

    --color-border: rgb(var(--dq-dark-volcanic-border-rgb));
    --color-border-strong: rgb(var(--dq-dark-ancient-gold-rgb));

    --color-status-success: rgb(var(--dq-dark-demonic-cyan-flame-rgb));
    --color-status-danger: rgb(var(--dq-dark-danger-crimson-rgb));
    --color-status-info: rgb(var(--dq-dark-soul-purple-rgb));

    --color-message-sent-bg: rgba(var(--dq-dark-nightsky-black-rgb), 0.75);
    --color-message-sent-text: var(--color-text-primary);
    --color-message-received-bg: rgba(var(--dq-dark-volcanic-border-rgb), 0.9);
    --color-message-system-bg: rgba(var(--dq-dark-obsidian-panel-rgb), 0.85);
    --color-message-system-text: var(--color-status-info);

    /* --- 1c. Overriding Typography & Layout --- */
    --font-family-base: "LXGW WenKai TC", "STKaiti", "SimSun", serif;
    --border-radius-md: 5px;
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(var(--dq-dark-heavenly-flame-red-rgb), 0.25);

    /* --- 1d. Character Color Palette --- */
    --xiaoyan-primary: #D24628;
    --xiaoyan-text: #1E1E1E;
    --xiaoyan-accent: #328CAA;
    --xiaoyan-glow: #BE8C32;
    --xiaoyan-msg-bg: linear-gradient(135deg, rgba(30, 30, 30, 0.1), rgba(30, 30, 30, 0.3));
    --xiaoyan-secondary-bg: rgba(30, 30, 30, 0.3);

    --yaolao-primary: #6E50A0;
    --yaolao-text: #E6EBF0;
    --yaolao-accent: #6496D2;
    --yaolao-glow: #6496D2;
    --yaolao-msg-bg: linear-gradient(135deg, rgba(110, 80, 160, 0.1), rgba(110, 80, 160, 0.2));
    --yaolao-secondary-bg: rgba(230, 235, 240, 0.08);

    --medusa-primary: #B43264;
    --medusa-text: var(--color-border-strong);
    --medusa-accent: #643C82;
    --medusa-glow: #B43264;
    --medusa-msg-bg: linear-gradient(135deg, rgba(100, 60, 130, 0.1), rgba(180, 50, 100, 0.15));
    --medusa-secondary-bg: rgba(100, 60, 130, 0.2);

    --xiaoxian-primary: #6E7873;
    --xiaoxian-text: rgba(var(--dq-dark-text-ash-white-rgb), 0.8);
    --xiaoxian-accent: #6E7873;
    --xiaoxian-msg-bg: linear-gradient(135deg, rgba(110, 110, 120, 0.05), rgba(110, 110, 120, 0.12));
    --xiaoxian-secondary-bg: rgba(110, 110, 120, 0.15);

    --yunyun-primary: #5A96AA;
    --yunyun-text: var(--color-text-primary);
    --yunyun-accent: #A07828;
    --yunyun-glow: #A07828;
    --yunyun-msg-bg: linear-gradient(135deg, rgba(90, 150, 170, 0.08), rgba(90, 150, 170, 0.15));
    --yunyun-secondary-bg: rgba(90, 150, 170, 0.15);

    --xuner-primary: #B48228;
    --xuner-text: var(--color-background-page);
    --xuner-accent: var(--color-brand-primary);
    --xuner-glow: var(--color-brand-primary);
    --xuner-msg-bg: linear-gradient(135deg, rgba(180, 130, 40, 0.1), rgba(180, 130, 40, 0.18));
    --xuner-secondary-bg: rgba(180, 130, 40, 0.2);

    --haibodong-primary: #64AAD8;
    --haibodong-text: var(--color-background-page);
    --haibodong-accent: var(--color-background-page);
    --haibodong-glow: var(--color-background-page);
    --haibodong-msg-bg: linear-gradient(135deg, rgba(100, 170, 220, 0.08), rgba(100, 170, 220, 0.15));
    --haibodong-secondary-bg: rgba(100, 170, 220, 0.15);

    --ziyan-primary: #A05AB4;
    --ziyan-text: var(--color-text-primary);
    --ziyan-accent: var(--color-text-primary);
    --ziyan-glow: var(--color-text-primary);
    --ziyan-msg-bg: linear-gradient(135deg, rgba(160, 90, 200, 0.08), rgba(160, 90, 200, 0.15));
    --ziyan-secondary-bg: rgba(160, 90, 200, 0.15);
}

/*
================================================================
|           2. Global Style Overrides for this Theme           |
================================================================
*/
body.theme-斗破苍穹-深色 {
    background-image: var(--custom-background-image,
    radial-gradient(ellipse at top right, rgba(var(--dq-dark-heavenly-flame-red-rgb), 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(var(--dq-dark-soul-purple-rgb), 0.12) 0%, transparent 70%),
    radial-gradient(circle at top left, rgba(var(--dq-dark-demonic-cyan-flame-rgb), 0.08) 0%, transparent 50%)
    );
    /* --- [可读性优化] START --- */
    font-weight: 500; /* 全局增加基础字重，让“霞鹜文楷”更清晰 */
    /* --- [可读性优化] END --- */
}

/* --- [可读性优化] START --- */
body.theme-斗破苍穹-深色 .message-content {
    font-size: 1.05rem; /* 略微增大消息正文字体 */
}
body.theme-斗破苍穹-深色 .preview {
    font-size: 0.9rem; /* 增大预览字体 */
}
/* --- [可读性优化] END --- */


body.theme-斗破苍穹-深色 .app-container {
    border: 1px solid rgba(var(--dq-dark-volcanic-border-rgb), 0.6);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(5px);
}

body.theme-斗破苍穹-深色 .chat-header.character-active::after {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--character-primary-color), var(--character-accent-color), transparent);
    opacity: 0.8;
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    filter: blur(0.5px);
}

body.theme-斗破苍穹-深色 .system-message {
    border: 1px dashed var(--color-status-info);
    box-shadow: 0 0 10px rgba(var(--dq-dark-soul-purple-rgb), 0.2) inset;
}

/*
================================================================
|         3. Character-specific Variable Application           |
================================================================
*/
body.theme-斗破苍穹-深色 .AI_萧炎_斗破苍穹 {
    --character-primary-color: var(--xiaoyan-primary);
    --character-text-color: var(--xiaoyan-text);
    --character-accent-color: var(--xiaoyan-accent);
    --character-message-bg: var(--xiaoyan-msg-bg);
    --character-secondary-bg: var(--xiaoyan-secondary-bg);
    --character-glow-color: var(--xiaoyan-glow);
}

body.theme-斗破苍穹-深色 .AI_药老_斗破苍穹 {
    --character-primary-color: var(--yaolao-primary);
    --character-text-color: var(--yaolao-text);
    --character-accent-color: var(--yaolao-accent);
    --character-message-bg: var(--yaolao-msg-bg);
    --character-secondary-bg: var(--yaolao-secondary-bg);
    --character-glow-color: var(--yaolao-glow);
}

body.theme-斗破苍穹-深色 .AI_美杜莎_斗破苍穹 {
    --character-primary-color: var(--medusa-primary);
    --character-text-color: var(--medusa-text);
    --character-accent-color: var(--medusa-accent);
    --character-message-bg: var(--medusa-msg-bg);
    --character-secondary-bg: var(--medusa-secondary-bg);
    --character-glow-color: var(--medusa-glow);
}

body.theme-斗破苍穹-深色 .AI_小医仙_斗破苍穹 {
    --character-primary-color: var(--xiaoxian-primary);
    --character-text-color: var(--xiaoxian-text);
    --character-accent-color: var(--xiaoxian-accent);
    --character-message-bg: var(--xiaoxian-msg-bg);
    --character-secondary-bg: var(--xiaoxian-secondary-bg);
    --character-glow-color: transparent;
}

body.theme-斗破苍穹-深色 .AI_云韵_斗破苍穹 {
    --character-primary-color: var(--yunyun-primary);
    --character-text-color: var(--yunyun-text);
    --character-accent-color: var(--yunyun-accent);
    --character-message-bg: var(--yunyun-msg-bg);
    --character-secondary-bg: var(--yunyun-secondary-bg);
    --character-glow-color: var(--yunyun-glow);
}

body.theme-斗破苍穹-深色 .AI_萧薰儿_斗破苍穹 {
    --character-primary-color: var(--xuner-primary);
    --character-text-color: var(--xuner-text);
    --character-accent-color: var(--xuner-accent);
    --character-message-bg: var(--xuner-msg-bg);
    --character-secondary-bg: var(--xuner-secondary-bg);
    --character-glow-color: var(--xuner-glow);
}

body.theme-斗破苍穹-深色 .AI_海波东_斗破苍穹 {
    --character-primary-color: var(--haibodong-primary);
    --character-text-color: var(--haibodong-text);
    --character-accent-color: var(--haibodong-accent);
    --character-message-bg: var(--haibodong-msg-bg);
    --character-secondary-bg: var(--haibodong-secondary-bg);
    --character-glow-color: var(--haibodong-glow);
}

body.theme-斗破苍穹-深色 .AI_紫妍_斗破苍穹 {
    --character-primary-color: var(--ziyan-primary);
    --character-text-color: var(--ziyan-text);
    --character-accent-color: var(--ziyan-accent);
    --character-message-bg: var(--ziyan-msg-bg);
    --character-secondary-bg: var(--ziyan-secondary-bg);
    --character-glow-color: var(--ziyan-glow);
}

/*
================================================================
|        4. Theme-specific Character Style Enhancements        |
================================================================
*/

body.theme-斗破苍穹-深色 .chat-list-item.is-special.active {
    background-image: linear-gradient(to right, rgba(var(--dq-dark-heavenly-flame-red-rgb), 0.1), transparent);
    border-left: 3px solid var(--character-primary-color);
}

body.theme-斗破苍穹-深色 .user-profile-section.character-active {
    background: radial-gradient(circle at top, var(--character-secondary-bg), transparent 70%);
}

body.theme-斗破苍穹-深色 .user-profile-section.character-active hr {
    border-color: var(--character-accent-color);
    opacity: 0.5;
}